#dockerfile.dingtalk.sh

#1
FROM timonwong/prometheus-webhook-dingtalk AS temp1
#2
FROM alpine AS temp2
COPY --from=temp1 /bin/prometheus-webhook-dingtalk /dingtalk
RUN date  && \
    sed -i 's/dl.*org/mirrors.aliyun.com/g' /etc/apk/repositories && \
    apk add --no-cache tzdata upx && \
    upx -qk dingtalk && \
    ls -hl dingtalk*
#3
FROM quay.io/prometheus/busybox-linux-amd64
COPY --from=temp2 /dingtalk /usr/sbin/dingtalk
COPY --from=temp2 /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN date && \
    mkdir -p /etc/dingtalk && \
    cd /etc/dingtalk && \
    wget http://elvin.vip/ks/conf/other/dingtalk.tmpl && \
    wget http://elvin.vip/ks/conf/other/dingtalk.yml && \
    mv dingtalk.yml config.yml

ENTRYPOINT ["dingtalk"]
CMD ["--config.file=/etc/dingtalk/config.yml"]

# docker build --no-cache -t alivv/dingtalk -f dockerfile.dingtalk.sh .
